/****************************************************************************

Force Engine v0.5

Creado: 28/03/08
Clase: Graphics.inl
Hecho by: German Battiston AKA Melkor

Modificado: 18/08/08

****************************************************************************/
//---------------------------------------------------------------------------
template <class PixelFormatClass, unsigned int FVF>
inline void Graphics::Draw( VertexBuffer<PixelFormatClass, FVF> vbVertexBuffer, 
							IndexBuffer ibIndexBuffer, 
							D3DPRIMITIVETYPE prim ) const
{
	ibIndexBuffer.Bind();
	vbVertexBuffer.Bind();

	vbVertexBuffer.Draw( static_cast<D3DPRIMITIVETYPE>(prim), 
						 ibIndexBuffer.GetIndexCount(),
						 vbVertexBuffer.GetVertexCount() );
}
//---------------------------------------------------------------------------
inline bool Graphics::GetIndexBuffer( IndexBuffer * pkIndexBuffer,
									  short * psIndices,
									  short usIdxCount) const
{
	if(!pkIndexBuffer->Create(m_pkDevice, true, usIdxCount, psIndices))
	{
		return false;
	}

	return true;
}
//---------------------------------------------------------------------------
template <class PixelFormatClass, unsigned int FVF>
inline bool Graphics::GetVertexBuffer( VertexBuffer<PixelFormatClass,FVF> * pkVertexBuffer,
									   PixelFormatClass * piVertices,
									   short uiVtxCount) const
{
	if(!pkVertexBuffer->Create(m_pkDevice, true, uiVtxCount, piVertices))
	{
		return false;
	}

	return true;
}
//---------------------------------------------------------------------------